#include "fontloader.h"

FontLoader::FontLoader(QObject *parent) : QObject(parent)
{

   m_clipboard = QGuiApplication::clipboard();



}

FontLoader::~FontLoader()
{
}


bool FontLoader::setFontFile(QString filePath)
{

    int lcdFontId = QFontDatabase::addApplicationFont(filePath.remove(0, 7));
    if (lcdFontId != -1) {
        this->m_loadedFont = QFontDatabase::applicationFontFamilies(lcdFontId).at(0);
        emit fontChanged(this->m_loadedFont);
        return true;
    }
    else {
        this->m_error = filePath;
        return false;
    }
}

void FontLoader::toClipboard(QString val)
{
    m_clipboard->setText(val);
}
